package com.smyh.bean.Enum;

import java.util.Vector;

public enum HostPointMockType {
	A_DF(1,"A相短路");
	
	private String name;
	private int index;
	/**
	 * 构造方法
	 * @param index
	 * @param desc
	 */
	HostPointMockType(int index,String desc){
		this.setIndex(index);
		this.setName(desc);
	}
	/**
	 * 普通方法
	 */
    public static String getName(int index) {
    	if(index==0){
    		return "";
    	}
        for (HostPointMockType hostPointMockType : HostPointMockType.values()) {  
            if (hostPointMockType.getIndex() == index) {  
                return hostPointMockType.name;  
            }  
        }  
        return " ";  
    }
    public static Integer getIndex(String name) {
		if("".equals(name)||name == null){
			return null;
		}
    	for (HostPointMockType hostPointMockType : HostPointMockType.values()) {  
    		if (hostPointMockType.getName() == name) {  
    			return hostPointMockType.index;  
    		}  
    	}  
    	return null;  
    }
    
    private static Vector vectors = null;
    /**
     * 返回所有的index
     * @return
     */
    public static Vector<Object> getIndexs(){
    	if(vectors==null){
    		vectors = new Vector<Object>();
    		vectors.add("");
    		for (HostPointMockType hostPointMockType : HostPointMockType.values()) {
    			vectors.add(hostPointMockType.index);
    		}
    	}
    	return vectors;
    }
    public static Vector<Object> getNames(){
    	if(vectors==null){
    		vectors = new Vector<Object>();
    		vectors.add("");
    		for (HostPointMockType hostPointMockType : HostPointMockType.values()) {
    			vectors.add(hostPointMockType.name);
    		}
    	}
    	return vectors;
    }
	public void setIndex(int index) {
		this.index = index;
	}
	public int getIndex() {
		return index;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getName() {
		return name;
	}

}
